Skip to content

Pin jQuery version in generated docs pages - #46

Merged
semihakbayrak merged 1 commit into
amazon-science:mainfrom
ombretta:docs/pin-jquery-version
Jul 14, 2026
Merged

Pin jQuery version in generated docs pages#46
semihakbayrak merged 1 commit into
amazon-science:mainfrom
ombretta:docs/pin-jquery-version

Conversation

@ombretta

@ombretta ombretta commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Summary

Pins the jQuery version referenced by the rendered notebook pages of the documentation site to a single current release.

Background

The mknotebooks plugin injects a Jupyter-widgets renderer snippet into each rendered notebook page (basic, placebo_test, azcausal). That snippet references an older jQuery release from a CDN. This normalises it to a consistent, current version.

Change

  • Add an mkdocs on_post_page hook (hooks/pin_jquery_version.py) that rewrites older jQuery references in the generated HTML to a pinned 3.7.1.
  • Handles both the cdnjs (ajax/libs/jquery/x.y.z/jquery.min.js) and code.jquery.com (jquery-x.y.z.min.js) URL forms; leaves current versions and non-jQuery scripts untouched.
  • Placed outside docs/ so the hook source is not published as a static asset.
  • Registered via hooks: in mkdocs.yml; runs on every mkdocs build/deploy.

Testing

Built the docs locally and compared the generated HTML with and without the hook:

Generated page Without hook With hook
examples/azcausal/index.html jquery/2.0.3 jquery/3.7.1
examples/basic/index.html jquery/2.0.3 jquery/3.7.1
examples/placebo_test/index.html jquery/2.0.3 jquery/3.7.1

With the hook, all rendered pages reference jQuery 3.7.1 and no reference below 3.5.0 remains anywhere in the built site. The control build (hook removed) confirms the pinning is what changes the output.

Add an mkdocs on_post_page hook that normalises the jQuery version referenced by
rendered notebook pages (injected by the mknotebooks widget renderer) to a
single current, pinned release (3.7.1). The hook lives outside docs/ so it is
not published as a static asset and runs on every mkdocs build.
@semihakbayrak semihakbayrak reopened this Jul 14, 2026
@semihakbayrak
semihakbayrak merged commit f39caea into amazon-science:main Jul 14, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants